﻿namespace PageAdmin.Utils
{
    [ConfigFile("/Config/System.config")]
    /// <summary>
    /// 系统配置类，依赖Config目录下的System.config文件
    /// </summary>
    public class SystemConfig:ConfigModelBase<SystemConfig>
    {
        /// <summary>
        /// 应用AccessKeyId
        /// </summary>
        public string AccessKeyId { get; set; }

        /// <summary>
        /// 应用AccessKeySecret
        /// </summary>
        public string AccessKeySecret { get; set; }

        /// <summary>
        /// 系统主域名
        /// </summary>
        public string Domain {
            get
            {
                return System.Configuration.ConfigurationManager.AppSettings["Domain"].Trim();
            }
        }
        /// <summary>
        /// 对称加密秘钥
        /// </summary>
        public string SecretKey { get; set; }

        /// <summary>
        /// 会员域名
        /// </summary>
        public string MemberDomain { get; set; }

        /// <summary>
        /// 后台域名
        /// </summary>
        public string AdminDomain { get; set; }


        /// <summary>
        /// 管理地址
        /// </summary>
        public string AdminPath { get; set; }

        /// <summary>
        /// webapi 时间戳有效期,单位分钟
        /// </summary>
        public int TimestampInterval { get; set; } = 60;

        /// <summary>
        /// 密码复杂程度验证表达式
        /// </summary>
        public string PasswordRegex { get; set; }

        /// <summary>
        /// 登录过期分钟数
        /// </summary>
        public int LoginedExpireMinutes { get; set; } = 30;

        /// <summary>
        /// 是否运行多人登录
        /// </summary>
        public bool MultipleLogin { get; set; } = false;

        /// <summary>
        /// 检测登录ip
        /// </summary>
        public bool CheckLoginIP { get; set; }

        /// <summary>
        /// 登录保护类型admin,member,all
        /// </summary>
        public string LoginProtect { get; set; }

        /// <summary>
        /// 登录保护类型
        /// </summary>
        public string LoginLockType { get; set; }

        /// <summary>
        /// 锁定错误次数
        /// </summary>
        public int LoginLockErrorTimes { get; set; }

        /// <summary>
        /// 锁定分钟数
        /// </summary>
        public int LoginLockMinutes { get; set; }

        /// <summary>
        /// 管理认证码
        /// </summary>
        public string AdminAuthenticationCode { get; set; }

        /// <summary>
        /// Redis通讯地址
        /// </summary>
        public string RedisHost { get; set; }

        /// <summary>
        /// 内网地址，填写后api请求将采用内网地址，避免某些外网映射到内网时,api请求失败
        /// </summary>
        public string IntranetAddress { get; set; }

        /// <summary>
        /// 管理员登录限制的ip段
        /// </summary>
        public string AdminIPLimit { get; set; }

        /// <summary>
        /// 跨域支持的域名。
        /// </summary>
        public string CrossDomain { get; set; }

        /// <summary>
        /// 日期期限，超过主动清理，0为不清理
        /// </summary>
        public int LogExpire { get; set; }

        /// <summary>
        /// 表的缓存时间
        /// </summary>
        public int TableCacheMinutes { get; set; }


        /// <summary>
        /// 自动任务的运行时间间隔，秒
        /// </summary>
        public int AutoTaskInterval { get; set; }

        /// <summary>
        /// 是否启用错误拦截句柄
        /// </summary>
        public bool ExceptionHandled { get; set; } = false;

        /// <summary>
        /// 错误是否记录到日志文件
        /// </summary>
        public bool ExceptionSaveLog { get; set; } = true;


    }
}
